<?php

/***************************************************************************
 Jupiter Content System @ Jupiterportal.com
 Copyright (C) 2005 Cosmin Flavius (highstrike@gmail.com)

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU General Public License
 as published by the Free Software Foundation; either version 2
 of the License, or (at your option) any later version.

 More Info About The Licence At http://www.gnu.org/copyleft/gpl.html
****************************************************************************/

//-----------------------------------------------------------------
//  If user is guest and restriction is turned on
//-----------------------------------------------------------------

if($config['forum_guest_see'] == "0" && isset($is_guest))
{ header("location: $PHP_SELF?i=2"); exit; }

//-----------------------------------------------------------------
// Clean the output
//-----------------------------------------------------------------
ob_end_clean();

//-----------------------------------------------------------------
// Echo out the XML Declaration
//-----------------------------------------------------------------

echo('<?xml version="1.0" encoding="UTF-8"?><rss version="2.0">');
echo('<channel>
    	<title>'.$config['website_name'].'</title>
		<description>Site Powered by Jupiter CMS.</description>
		<link>'."http://".$_SERVER['HTTP_HOST']."".$_SERVER['PHP_SELF']."".'</link>');

//-----------------------------------------------------------------
//  Start Navigation
//-----------------------------------------------------------------

switch($a)
{
	//topic rss
	case 1:
		
		$results = $db->getTable("SELECT * FROM forum_replies WHERE topic = ".$db->escape($_GET['l']));
		
		foreach ($results as $result) {
			
			echo(
				'<item>
				
					<title>Post #'.$result["id"].' by '.$result["user_user"].'</title>
					<link>'.'http://'.$_SERVER["HTTP_HOST"].''.$_SERVER["PHP_SELF"].'?n=modules/forum&a=3&d='.$result["cat"].'&o='.$result["subcat"].'&q='.$result["id"].''.'</link>
					<dc:creator>'.$result["user_user"].'</dc:creator>
					
					<description><![CDATA['.$result["message"].']]></description>
				
				</item>'
			);
			
		}
		
	break;
	
}

echo('</channel></rss>');

//-----------------------------------------------------------------
// Prematurely end
//-----------------------------------------------------------------
exit;